package com.yiqi.liebang.feature.order.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.yiqi.liebang.entity.bo.AnswerBo;
import com.yiqi.liebang.entity.bo.CommentBo;
import com.yiqi.liebang.entity.bo.ExpertTopicBo;
import com.yiqi.liebang.entity.bo.OrderQuestionInfofBo;
import com.yiqi.liebang.entity.bo.TopicOrderInfoBo;
import com.yiqi.liebang.feature.order.contract.QuestionInfoContract;
import com.yiqi.liebang.feature.order.contract.TopicInfoContract;
import com.yiqi.liebang.feature.order.dependencies.questionInfo.DaggerQuestionInfoModelComponent;
import com.yiqi.liebang.feature.order.dependencies.topicinfo.DaggerTopicInfoModelComponent;
import com.yiqi.liebang.framework.api.ApiLib;
import com.yiqi.liebang.framework.api.HomeApi;

import javax.inject.Inject;

import io.reactivex.Observable;
import retrofit2.http.Body;

public class TopicInfoModel implements TopicInfoContract.Model {

    @Inject
    HomeApi api;


    @Inject
    public TopicInfoModel() {
        DaggerTopicInfoModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<TopicOrderInfoBo> getOrderTopicInfo(String id,int type) {
        return api.getTopicOrderInfo(id,type).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> cancleOrder(CommentBo id) {
        return api.cancleOrder(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> refusedQuestion(String id) {
        return api.toRefusedTopic(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> toExpertConfrim(ExpertTopicBo expertTopicBo) {
        return api.appointmentTopicOrderExpert(expertTopicBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> toStudentConfrim(String id) {
        return api.toStudentConfirm(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }


    @Override
    public Observable<String> toAnswer(CommentBo answerBo) {
        return api.toCommentQuestion(answerBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> toStudentComplete(String id) {
        return api.toStudentComplete(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> toExpertComplete(String id) {
        return api.toExpertComplete(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> remindExpertsConfirm(ExpertTopicBo id) {
        return api.remindExpertsConfirm(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> commentTopicOrder(CommentBo id) {
        return api.toCommentTopicOrder(id).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
